// 获取当前选项卡ID
function getCurrentTabId(callback: any) {
    chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
        if (callback) callback(tabs.length ? tabs[0].id : null);
    });
}

function sendMessageToContentScript(message: any, callback: any) {
    getCurrentTabId((tabId: any) => {
        chrome.tabs.sendMessage(tabId, message, function (response) {
            if (callback) callback(response);
        });
    });
}


let button = document.getElementById('click');

if (button) {
    button.onclick = (() => {
        sendMessageToContentScript({cmd: 'down_good_list'}, function (response: any) {
        });
    });
}
